package com.jxaummd.aquaculture.ui.fragment.first.fun;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;

import com.blankj.utilcode.util.ToastUtils;
import com.jxaummd.aquaculture.R;
import com.jxaummd.aquaculture.base.BaseBackFragment;
import com.jxaummd.aquaculture.entity.Device;

public class RangeChooseFragment extends BaseBackFragment {

    private EditText mEditUp;
    private EditText mEditDown;
    private TextView mHintText;
    private TextView mSaveText;



    private String title;

    public static RangeChooseFragment newInstance(String title) {
        Bundle args = new Bundle();
        RangeChooseFragment fragment = new RangeChooseFragment();
        fragment.setArguments(args);
        fragment.title = title;
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_device_choose_range, container, false);
        initView(view);
        return view;
    }


    private void initView(View view) {
        Toolbar toolbar = view.findViewById(R.id.toolbar);
        mEditUp = view.findViewById(R.id.fragment_device_range_up);
        mEditDown= view.findViewById(R.id.fragment_device_range_down);
        mHintText = view.findViewById(R.id.fragment_device_range_hint_text);
        mSaveText=view.findViewById(R.id.fragment_device_choose_range_save);

        mSaveText.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ToastUtils.showShort("保存成功");
                pop();
            }
        });
        toolbar.setTitle(title);
        initToolbarNav(toolbar);

        if(title.contains("温度")){
            mHintText.setText("");
        }else {
            mHintText.setText("");
        }
    }

}
